<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>promise</title>
		
	</head>
	<body>
		<div id="show">
			
		</div>
		<script>
		 function disp(s){
			 document.getElementById("show").innerHTML=s;
		 }
		 let pro=new Promise(function(myResolve,myReject){
			let req=new XMLHttpRequest();
			req.open('GET','../3.html');
			req.onload=function(){
				if(req.status==200){
					myResolve(req.response);
				}else{
					myReject("File not found");
				}
			};
			req.send();
		 });
		 pro.then(function(v){
			 disp(v);
		 },function(er){
			 disp(er);
		 })
		</script>
	</body>
</html>
